create-diff-object: Fix ordering of __patchable_function_entries#1451
create-diff-object: Fix ordering of __patchable_function_entries#1451joe-lawrence merged 1 commit intodynup:masterfrom
Conversation
Old linkers don't support mixing ordered and unordered sections. This was fixed in binutils, see discussion in [1]. But without this fix, kpatch-build fails with an error like: | ld.bfd: __patchable_function_entries has both ordered | [`__patchable_function_entries' in /builddir/.kpatch/tmp/patch/output.o] | and unordered [`__patchable_function_entries' in | /builddir/.kpatch/tmp/patch/patch-hook.o] sections | ld.bfd: final link failed: bad value Fix this by only setting SHF_LINK_ORDER in the output object if the patched object also has this flag set. Signed-off-by: Puranjay Mohan <pjy@amazon.com>
3fd4fa5 to
9ea87f8
Compare
|
@wardenjohn : IIRC, you hit this problem a while back? If so, do you want to try @puranjaymohan 's patch? |
|
Right, I had faced this problem. It seems that I mentioned it in a comment area instead of raising a new issues. This problem seem only happen under arm64 |
|
@puranjaymohan Would you share the discussion link as mention in your pr as [1]? |
|
@wardenjohn : do you have a link for that discussion and did you ever resolve it (or apply something similar to the patch here)? |
|
@joe-lawrence And yet, I still not have a good solution to it, and @puranjaymohan seems give me a hope to this problem. I am now starting to test this patch if can fix it :) |
@joe-lawrence You can check the email I send you at Feb, 21, 2025. |
Ah ok, yes that was the bug report I was thinking of. Since it is over e-mail, there's nothing to link to in this PR, but if you are willing to give it a test drive on your Arm64 port and report back, that would be much appreciated, thanks! |
|
@joe-lawrence Sure, I will give you a test report as soon as possible. Since the master branch do not support Arm64, I may test on @puranjaymohan 's arm64 branch of PR [https://github.com//pull/1439] with this patch. It that OK? |
|
@joe-lawrence Do you need me copy the bug report and raise an new issuse here? |
Here it is: https://sourceware.org/bugzilla/show_bug.cgi?id=26256 |
Sure that's fine. It's more of a sanity check for your own use (you'll know that the bug is fixed :)
No need to duplicate it, you can just follow up here. Thanks. |
|
@joe-lawrence FYI,I tried a patch made changes fork.c and mmap.c, this patch successfully built in x86_64 and it seems looks well. However, I changed into this branch and tried to build it under aarch64, with the same patch, found the error: |
|
@wardenjohn Can you share the patch that you tested? and did you use this PR on top of the PR for the arm64 support? |
|
@puranjaymohan quite strange.... I don't know what happened to my env. After I rebuild and reinstall your branch (I used your arm64 branch and patch the commit from pfe_ordering_fix). And I retried a patch just chaning meminfo_proc_show and seems good. And I am sorry for answering late, for I am quite busy that days. :) Since this patch is quite easy, I will try a more complex patch later. :) |
|
I'll merge this now and if @wardenjohn has any further issues, we'll just open a new ticket. Thanks guys. |
Old linkers don't support mixing ordered and unordered sections. This was fixed in binutils, see discussion in [1]. But without this fix, kpatch-build fails with an error like:
Fix this by only setting SHF_LINK_ORDER in the output object if the patched object also has this flag set.
[1] https://sourceware.org/bugzilla/show_bug.cgi?id=26256